<div class="row">
<script language="javascript" type="text/javascript" src="/js/DatePicker/WdatePicker.js"></script>
<style type="text/css">
.Wdate{border:0px; }
</style>

 <small>
 <div class="span3 bs-docs-sidebar ">
 	<*include file="<*$controller*>/location.tpl"*>
 </div>

  <div class="span5">
<form action="/<*$controller*>/opadd" method="post"   name="form1" class="form-horizontal" onSubmit="return checkform()">       
<table class="table table-bordered  table-striped">
<tr><td>选择机构：</td><td><select id="jigou" name="groups"  ></select></td></tr>
<tr><td>选择学校：</td><td><select id="school" name="school" ></select></td></tr>
<tr><td>考勤机ID：</td><td><input type="text" name="mid" id="mid"  ></td></tr>
<tr ><td colspan="2"></td></tr>
<tr height="50"><td colspan="2"><input type="submit" class="btn btn-success"  value="确定"  >&nbsp;&nbsp;<button type="button" class="btn" onclick="history.back()">返回</button></td></tr>
</table>
</form>
   </div>
<script type="text/javascript"> 
  
  
 
       function   ajax_post(){ 
	    var groupsid="<*$groups*>"; 
        $.post("/<*$controller*>/groups/",{"jigouid":groupsid},function(data,statusText){ 
			 $("#jigou").append(data); 
        });  
	 } 
	  
	  $("#jigou").change(function(){
           // $("#city option:gt(0)").remove();  //清空所有城市的信息
            //$("#county option:gt(0)").remove();  //清空所有县级的信息
            var id = this.value;
			var schoolid="<*$schoolid*>";  
			  
            $.post("/<*$controller*>/schoollist/",{"id":id,"sid":schoolid},function(data,statusText){
                 $("#school").html('');
                 $("#school").append(data);
            
            });
        });
		
		$("#school").change(function(){
           // $("#city option:gt(0)").remove();  //清空所有城市的信息
            //$("#county option:gt(0)").remove();  //清空所有县级的信息
            var sid = this.value; 
            $.post("/<*$controller*>/classlist/",{"id":sid},function(data,statusText){
				 
                 $("#class1").html('');
                 $("#class1").append(data);
            
            });
        });
		
	
	 window.onload=function(){
	    ajax_post(); 
	 if( '<*$groups*>'+0 != 0 ){ 
	        
			var id = '<*$groups*>'; 
			var sid = '<*$schoolid*>';  
			 
			$.post("/<*$controller*>/schoollist/",{"id":id,"sid":sid},function(data,statusText){
				 $("#school").html('');
				 $("#school").append(data); 
				});
	    } 
          
	 if('<*$schoolid*>'+0 != 0){   
		   var id = '<*$schoolid*>'; 
		   var cid='<*$classid*>';
			$.post("/<*$controller*>/classlist/",{"id":id,"cid":cid},function(data,statusText){ 
				 $("#class1").html('');
				 $("#class1").append(data); 
				}); 
		   
	 }

 } 
	
function detailfun(sid,gid){
   window.location='/<*$controller*>/detailed/sid/'+sid+'/gid/'+gid;   
}  		 
		
function choose(val){
		var productid=document.getElementById("productid").value;
		if(productid == 1){
			 document.getElementById("num").disabled = false;
		}else{
			 document.getElementById("num").disabled = true;
		}
}
</script>
</div>